let timer;
let remainingTime;

const startTimer = (initialTime) => {
    console.log(initialTime);

    remainingTime = initialTime;
    timer = setInterval(() => {
        if (remainingTime > 0) {
            remainingTime--;
        } else {
            clearInterval(timer);
        }
    }, 1000);
};

const getRemainingTime = () => remainingTime;

const stopTimer = () => {
    clearInterval(timer);
};

export { startTimer, getRemainingTime, stopTimer };